package com.example.sport.domain;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.Pattern;
import lombok.Data;

import java.time.LocalDateTime;

@Data
@TableName("t_user")
public class User {
    @TableId(type = IdType.AUTO)
    private Integer id;
    private String name;

    private String username;

    @JsonIgnore
    private String password;


    private String role;


    private Integer collegeId;

    @TableField(exist = false)
    private String collegeName;
    @TableField(exist = false)
    private String leader;


    public enum Role {
        ATHLETE,
        JUDGE,
        ADMIN
    }

    public Role getRoleEnum() {
        return Role.valueOf(this.role);
    }

    public void setRoleEnum(Role role) {
        this.role = role.name();
    }
}